package com.xingkeduo.business.order.remote;

import com.xingkeduo.business.order.remote.feign.CommentFeignService;
import com.xingkeduo.dto.CommentsResponseDto;
import com.xingkeduo.pojo.table.Comments;
import com.xingkeduo.utils.ResponseUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author chi  2019-04-03 14:59
 **/
@Service
public class CommentRemoteService {

    @Resource
    private CommentFeignService commentFeignService;

    public CommentsResponseDto getComment(long orderId){

        ResponseUtils<Comments> responseUtils = commentFeignService.queryDetailByorderId(orderId);
        CommentsResponseDto commentsResponseDto = new CommentsResponseDto();
        if(responseUtils !=null && responseUtils.success()){
            BeanUtils.copyProperties(responseUtils.getData(), commentsResponseDto);
            commentsResponseDto.covert();
        }
        return commentsResponseDto;

    }

}
